package com.youzi.usercenter.controller;

import com.youzi.usercenter.form.ModifyPasswordForm;
import com.youzi.usercenter.model.TUser;
import com.youzi.usercenter.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by tanxl on 2017-12-18.
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    UserService userService;

    /**
     * 修改用户信息
     *
     * @param user
     */
    @PostMapping("/update")
    public void update(@RequestBody TUser user) {
        userService.update(user);
    }

    /**
     * 修改密码
     *
     * @param form
     */
    @PostMapping("/updatePassword")
    public void updatePassword(@RequestBody ModifyPasswordForm form) {
        userService.updatePassword(form);
    }

}
